<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>循环结构</title>
	</head>
	<body>
		<div id="app">
			<!-- 1. -->
			<h3 v-for="item in hobbys" v-text="item" :key="item"></h3>
			<!-- 2.带下标的循环遍历语法 2个参数 参数1：遍历的数据  参数2：下标 -->
			<h3 v-for="(item,index) in hobbys" v-text="item" :key="index"></h3>
			<!-- 循环遍历对象 -->
			<div v-for="user in userList">
				<span v-text="user.id"></span>
				<span v-text="user.name"></span>
			</div>
		</div>
			
			
			<script src="../js/vue.js"></script>
			<script>
				const app=new Vue({
					el:"#app",
					data:{
						//采用数组形式保存多个数据
						hobbys:['打游戏','敲代码','喝水','水网吧'],
						userList:[{
							id:100,
							name:'孙尚香'
						},{id:200,
						   name:'王少军'
						},{id:300,
						   name:'项羽'
						}]
					}
				})
				
			</script>
	</body>
</html>
